package com.minhang.service.impl;


import com.minhang.domain.LogWithBLOBs;
import com.minhang.domain.to.LogTo;
import com.minhang.mapper.LogMapper;
import com.minhang.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author rookie
 */
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    /**
     * 添加一个日志
     *
     * @param log
     */
    @Override
    public void save(LogWithBLOBs log) {
        logMapper.insert(log);
    }

    /**
     * 根据id查询
     *
     * @param logId
     * @return
     */
    @Override
    public LogWithBLOBs queryByLogId(Long logId) {
        return logMapper.selectByPrimaryKey(logId);
    }

    /**
     * 根据id删除
     *
     * @param logId
     */
    @Override
    public void deleteByLogId(Long logId) {
        logMapper.deleteByPrimaryKey(logId);
    }

    /**
     * 多条件查询
     *
     * @param logTo
     * @return
     */
    @Override
    public List<LogWithBLOBs> queryByCondition(LogTo logTo) {
        return logMapper.selectByCondition(logTo);
    }
}
